package sctu.edu.java.year2016.team04.baiyunfei.day20160524.chapter5_2;

/**
 *将arr[]数组中的最大值输出
 * Created by DE on 2016/5/24.
 */
public class Chapter5_2 {
    public static void main(String[] args) {
        int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 10, 9};

        for (int i = 0; i < arr.length - 1; i++) {

            if (arr[i] > arr[i + 1]) {

                arr[i] = arr[i] ^ arr[i + 1];
                arr[i + 1] = arr[i + 1] ^ arr[i];
                arr[i] = arr[i] ^ arr[i + 1];

            }

        }
        System.out.print("该数组中最大的数为：");
        System.out.println(+arr[arr.length-1]);
    }
}



